package thread;

/**
 * 线程优先级
 */
public class PriorityDemo {
    public static void main(String[] args) {
        Thread min = new Thread(){
            @Override
            public void run() {
                for (int i = 0;i < 10000;i ++){
                    System.out.println("min");
                }
            }
        };

        Thread norm = new Thread(){
            @Override
            public void run() {
                for (int i = 0;i < 10000;i ++){
                    System.out.println("nor");
                }
            }
        };

        Thread max = new Thread(){
            @Override
            public void run() {
                for (int i = 0;i < 10000;i ++){
                    System.out.println("max");
                }
            }
        };

        //设置优先级
        min.setPriority(1);
        max.setPriority(10);

        min.start();
        norm.start();
        max.start();
    }
}
